package com.mjx.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mjx.entity.Test;
import com.mjx.dao.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by meijingxiang on 2017/2/17.
 */
@RestController
public class TestController {

    @Autowired
    TestMapper testMapper;

    @GetMapping("/test")
    public JSON test(String id){
        Test test = new Test();
        test.setAge(2);
        test.setDel(false);
        test.setName("asdasd");
        testMapper.save(test);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("test",testMapper.findAll());
        return jsonObject;
    }
}
